<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>玩家社区 - 我的世界服务器</title>
    <script src="https://cdn.tailwindcss.com"></script>
    <link href="https://cdn.jsdelivr.net/npm/font-awesome@4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <script>
        tailwind.config = {
            theme: {
                extend: {
                    colors: {
                        primary: '#22c55e',
                        secondary: '#165DFF',
                        dark: '#1e293b',
                        light: '#f8fafc'
                    }
                }
            }
        }
    </script>
    <style type="text/tailwindcss">
        @layer utilities {
            .content-auto {
                content-visibility: auto;
            }
            .community-card {
                transition: transform 0.3s ease, box-shadow 0.3s ease;
            }
            .community-card:hover {
                transform: translateY(-5px);
                box-shadow: 0 10px 25px -5px rgba(34, 197, 94, 0.2), 0 10px 10px -5px rgba(34, 197, 94, 0.1);
            }
        }
    </style>
    <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
</head>
<body class="bg-dark text-light font-inter antialiased">
    <!-- 导航栏 -->
    <header class="fixed w-full z-50 transition-all duration-300 bg-dark/95">
        <div class="bg-dark/80 bg-blur py-4 px-6 md:px-12">
            <div class="container mx-auto flex justify-between items-center">
                <a href="游戏官网.html" class="flex items-center space-x-3">
                    <div class="w-10 h-10 rounded-full bg-primary flex items-center justify-center">
                        <i class="fa fa-cubes text-xl text-white"></i>
                    </div>
                    <span class="text-xl font-bold text-white">我的世界服务器</span>
                </a>
                <nav class="hidden md:flex space-x-8">
                    <a href="游戏官网.html#home" class="text-white hover:text-primary transition-colors duration-300">首页</a>
                    <a href="游戏官网.html#servers" class="text-white hover:text-primary transition-colors duration-300">服务器</a>
                    <a href="游戏官网.html#about" class="text-white hover:text-primary transition-colors duration-300">关于我们</a>
                    <a href="游戏官网.html#contact" class="text-white hover:text-primary transition-colors duration-300">联系我们</a>
                </nav>
                <button class="md:hidden text-white text-2xl" id="menu-toggle">
                    <i class="fa fa-bars"></i>
                </button>
            </div>
        </div>
        <!-- 移动端菜单 -->
        <div class="md:hidden hidden bg-dark/95 bg-blur" id="mobile-menu">
            <div class="px-6 py-4 space-y-4">
                <a href="游戏官网.html#home" class="block text-white hover:text-primary transition-colors duration-300">首页</a>
                <a href="游戏官网.html#servers" class="block text-white hover:text-primary transition-colors duration-300">服务器</a>
                <a href="游戏官网.html#about" class="block text-white hover:text-primary transition-colors duration-300">关于我们</a>
                <a href="游戏官网.html#contact" class="block text-white hover:text-primary transition-colors duration-300">联系我们</a>
            </div>
        </div>
    </header>

    <!-- 社区页面内容 -->
    <section class="pt-32 pb-20 px-6">
        <div class="container mx-auto max-w-6xl">
            <div class="text-center mb-16">
                <h1 class="text-[clamp(2rem,5vw,3.5rem)] font-bold text-white mb-6">玩家社区</h1>
                <p class="text-white/70 max-w-2xl mx-auto text-lg">探索社区资源，分享你的创意，解决游戏问题</p>
            </div>

            <!-- 社区板块 -->
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8 mb-16">
                <!-- 光影板块 -->
                <div class="bg-dark/50 border border-gray-700 rounded-xl overflow-hidden community-card">
                    <div class="h-48 relative">
                        <img src="https://picsum.photos/id/111/600/400" alt="光影效果展示" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-dark to-transparent"></div>
                        <div class="absolute bottom-4 left-4">
                            <span class="px-3 py-1 bg-primary text-white text-sm font-semibold rounded-full">光影</span>
                        </div>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold text-white mb-3">光影效果分享</h3>
                        <p class="text-white/70 mb-4">探索各种精美的光影效果，提升你的游戏视觉体验。</p>
                        <button class="text-primary hover:text-primary/80 transition-colors duration-300 view-section w-full py-2 border border-primary rounded-lg" data-section="shaders">
                            查看 <i class="fa fa-arrow-right ml-1"></i>
                        </button>
                    </div>
                </div>

                <!-- 材质包板块 -->
                <div class="bg-dark/50 border border-gray-700 rounded-xl overflow-hidden community-card">
                    <div class="h-48 relative">
                        <img src="https://picsum.photos/id/112/600/400" alt="材质包展示" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-dark to-transparent"></div>
                        <div class="absolute bottom-4 left-4">
                            <span class="px-3 py-1 bg-primary text-white text-sm font-semibold rounded-full">材质包</span>
                        </div>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold text-white mb-3">材质包资源</h3>
                        <p class="text-white/70 mb-4">各种风格的材质包，让你的世界焕然一新。</p>
                        <button class="text-primary hover:text-primary/80 transition-colors duration-300 view-section w-full py-2 border border-primary rounded-lg" data-section="textures">
                            查看 <i class="fa fa-arrow-right ml-1"></i>
                        </button>
                    </div>
                </div>

                <!-- 解疑板块 -->
                <div class="bg-dark/50 border border-gray-700 rounded-xl overflow-hidden community-card">
                    <div class="h-48 relative">
                        <img src="https://picsum.photos/id/115/600/400" alt="解疑答惑" class="w-full h-full object-cover">
                        <div class="absolute inset-0 bg-gradient-to-t from-dark to-transparent"></div>
                        <div class="absolute bottom-4 left-4">
                            <span class="px-3 py-1 bg-primary text-white text-sm font-semibold rounded-full">解疑</span>
                        </div>
                    </div>
                    <div class="p-6">
                        <h3 class="text-xl font-bold text-white mb-3">常见问题解答</h3>
                        <p class="text-white/70 mb-4">新手引导、技术支持和常见问题的解决方案。</p>
                        <button class="text-primary hover:text-primary/80 transition-colors duration-300 view-section w-full py-2 border border-primary rounded-lg" data-section="faq">
                            查看 <i class="fa fa-arrow-right ml-1"></i>
                        </button>
                    </div>
                </div>
            </div>

            <!-- 板块内容展示区 -->
            <div id="section-content" class="bg-dark/50 border border-gray-700 rounded-xl p-8 min-h-[400px]">
                <div class="text-center py-12">
                    <i class="fa fa-users text-6xl text-primary/50 mb-6"></i>
                    <h2 class="text-2xl font-bold text-white mb-4">欢迎来到玩家社区</h2>
                    <p class="text-white/70 max-w-2xl mx-auto">
                        请从上方选择一个板块进行浏览，这里有丰富的资源和信息等待你发现。
                    </p>
                </div>
            </div>

            <div class="mt-12 text-center">
                <a href="游戏官网.html" class="inline-flex items-center px-8 py-3 bg-primary hover:bg-primary/90 text-white font-semibold rounded-lg transition-all duration-300">
                    <i class="fa fa-arrow-left mr-2"></i> 返回首页
                </a>
            </div>
        </div>
    </section>

    <!-- 用户设置和交流板块 (默认隐藏) -->
    <div id="user-community-section" class="fixed inset-0 z-50 hidden">
        <div class="absolute inset-0 bg-dark/90 backdrop-blur-sm" id="community-backdrop"></div>
        <div class="relative z-10 max-w-4xl mx-auto bg-dark border border-gray-700 rounded-xl p-8 mt-20 mb-10 max-h-[90vh] overflow-y-auto">
            <div class="flex justify-between items-center mb-6">
                <h2 class="text-2xl font-bold text-white">玩家社区交流</h2>
                <button id="close-community" class="text-white/60 hover:text-white text-xl">
                    <i class="fa fa-times"></i>
                </button>
            </div>
            
            <!-- 用户设置区域 -->
            <div id="user-settings" class="mb-8">
                <h3 class="text-xl font-semibold text-white mb-4">账户设置</h3>
                <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mb-6">
                    <div>
                        <label class="block text-white/70 mb-2">用户名</label>
                        <input type="text" id="username" class="w-full bg-dark/70 border border-gray-700 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-primary">
                    </div>
                    <div>
                        <label class="block text-white/70 mb-2">设置头像</label>
                        <input type="file" id="avatar-upload" accept="image/*" class="w-full text-white/70">
                    </div>
                </div>
                <button id="save-settings" class="px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg transition-colors">
                    保存设置
                </button>
            </div>
            
            <!-- 上传区域 -->
            <div class="mb-8 p-4 bg-dark/70 rounded-lg">
                <h3 class="text-xl font-semibold text-white mb-4">上传文件</h3>
                <input type="file" id="file-upload" class="w-full text-white/70 mb-4">
                <div>
                    <label class="block text-white/70 mb-2">留言</label>
                    <textarea id="upload-message" rows="3" class="w-full bg-dark/70 border border-gray-700 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-primary"></textarea>
                </div>
                <button id="submit-upload" class="mt-4 px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg transition-colors">
                    上传并发布
                </button>
            </div>
            
            <!-- 交流区 -->
            <div>
                <h3 class="text-xl font-semibold text-white mb-4">玩家交流</h3>
                <div id="messages-container" class="space-y-4 max-h-[300px] overflow-y-auto mb-6">
                    <!-- 消息会动态添加到这里 -->
                    <div class="p-4 bg-dark/70 rounded-lg border border-gray-700">
                        <div class="flex items-center mb-2">
                            <div class="w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center mr-2">
                                <i class="fa fa-user text-primary"></i>
                            </div>
                            <span class="text-white font-medium">系统消息</span>
                            <span class="text-white/50 text-xs ml-auto">刚刚</span>
                        </div>
                        <p class="text-white/70">欢迎来到玩家交流区，请先设置您的用户名</p>
                    </div>
                </div>
                
                <div class="flex gap-2">
                    <textarea id="message-input" rows="2" class="flex-1 bg-dark/70 border border-gray-700 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-primary" placeholder="输入消息..."></textarea>
                    <button id="send-message" class="px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg transition-colors">
                        发送
                    </button>
                </div>
            </div>
        </div>
    </div>

    <!-- 页脚 -->
    <footer class="bg-dark py-12 border-t border-gray-800">
        <div class="container mx-auto px-6">
            <div class="border-t border-gray-800 mt-6 pt-8 text-center">
                <p class="text-white/50">&copy; 2025/7/21 All Right Reserved by wang12ling.</p>
            </div>
        </div>
    </footer>

    <script>
        // 移动端菜单切换
        const menuToggle = document.getElementById('menu-toggle');
        const mobileMenu = document.getElementById('mobile-menu');
        
        menuToggle.addEventListener('click', () => {
            mobileMenu.classList.toggle('hidden');
            const icon = menuToggle.querySelector('i');
            if (icon.classList.contains('fa-bars')) {
                icon.classList.remove('fa-bars');
                icon.classList.add('fa-times');
            } else {
                icon.classList.remove('fa-times');
                icon.classList.add('fa-bars');
            }
        });

        // 社区板块内容切换
        const sectionButtons = document.querySelectorAll('.view-section');
        const contentArea = document.getElementById('section-content');
        const userCommunitySection = document.getElementById('user-community-section');
        const communityBackdrop = document.getElementById('community-backdrop');
        const closeCommunity = document.getElementById('close-community');

        // 各个板块的内容 - 仅保留框架，移除所有资源
        const sectionContents = {
            shaders: `
                <div>
                    <h2 class="text-2xl font-bold text-white mb-6 flex items-center">
                        <i class="fa fa-sun-o text-primary mr-3"></i> 光影效果分享
                    </h2>
                    <p class="text-white/70 mb-8">这里是玩家们分享的各种光影效果资源板块。</p>
                    
                    <!-- 上传功能 -->
                    <div class="mb-8 p-4 bg-dark/70 rounded-lg">
                        <h3 class="text-lg font-semibold text-white mb-4">上传光影资源</h3>
                        <input type="file" class="w-full text-white/70 mb-4">
                        <div>
                            <label class="block text-white/70 mb-2">资源描述</label>
                            <textarea rows="2" class="w-full bg-dark/70 border border-gray-700 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-primary"></textarea>
                        </div>
                        <button class="mt-4 px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg transition-colors">
                            上传资源
                        </button>
                    </div>
                </div>
            `,
            textures: `
                <div>
                    <h2 class="text-2xl font-bold text-white mb-6 flex items-center">
                        <i class="fa fa-th text-primary mr-3"></i> 材质包资源
                    </h2>
                    <p class="text-white/70 mb-8">各种风格的材质包分享板块。</p>
                    
                    <!-- 上传功能 -->
                    <div class="mb-8 p-4 bg-dark/70 rounded-lg">
                        <h3 class="text-lg font-semibold text-white mb-4">上传材质包</h3>
                        <input type="file" class="w-full text-white/70 mb-4">
                        <div>
                            <label class="block text-white/70 mb-2">材质包描述</label>
                            <textarea rows="2" class="w-full bg-dark/70 border border-gray-700 rounded-lg px-4 py-2 text-white focus:outline-none focus:border-primary"></textarea>
                        </div>
                        <button class="mt-4 px-4 py-2 bg-primary hover:bg-primary/90 text-white rounded-lg transition-colors">
                            上传资源
                        </button>
                    </div>
                </div>
            `,
            faq: `
                <div>
                    <h2 class="text-2xl font-bold text-white mb-6 flex items-center">
                        <i class="fa fa-question-circle text-primary mr-3"></i> 常见问题解答
                    </h2>
                    <p class="text-white/70 mb-8">点击下方按钮进入玩家社区，设置账户并参与交流。</p>
                    
                    <button id="enter-community" class="px-6 py-3 bg-primary hover:bg-primary/90 text-white font-semibold rounded-lg transition-all duration-300">
                        进入玩家社区 <i class="fa fa-users ml-2"></i>
                    </button>
                </div>
            `
        };

        // 为每个板块按钮添加点击事件
        sectionButtons.forEach(button => {
            button.addEventListener('click', () => {
                const section = button.getAttribute('data-section');
                contentArea.innerHTML = sectionContents[section];
                
                // 如果是FAQ板块，添加进入社区的事件
                if (section === 'faq') {
                    document.getElementById('enter-community').addEventListener('click', () => {
                        userCommunitySection.classList.remove('hidden');
                    });
                }
                
                // 滚动到内容区域
                contentArea.scrollIntoView({ behavior: 'smooth', block: 'start' });
            });
        });

        // 社区相关功能
        closeCommunity.addEventListener('click', () => {
            userCommunitySection.classList.add('hidden');
        });
        
        communityBackdrop.addEventListener('click', () => {
            userCommunitySection.classList.add('hidden');
        });

        // 保存用户设置
        document.getElementById('save-settings').addEventListener('click', () => {
            const username = document.getElementById('username').value;
            if (username) {
                alert(`设置已保存！欢迎你，${username}`);
            } else {
                alert('请输入用户名');
            }
        });

        // 发送消息功能
        document.getElementById('send-message').addEventListener('click', sendUserMessage);
        document.getElementById('message-input').addEventListener('keypress', (e) => {
            if (e.key === 'Enter' && !e.shiftKey) {
                e.preventDefault();
                sendUserMessage();
            }
        });

        function sendUserMessage() {
            const username = document.getElementById('username').value;
            const messageInput = document.getElementById('message-input');
            const message = messageInput.value.trim();
            
            if (!username) {
                alert('请先设置用户名');
                return;
            }
            
            if (message) {
                const messagesContainer = document.getElementById('messages-container');
                const now = new Date();
                const timeString = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`;
                
                const messageElement = document.createElement('div');
                messageElement.className = 'p-4 bg-dark/70 rounded-lg border border-gray-700';
                messageElement.innerHTML = `
                    <div class="flex items-center mb-2">
                        <div class="w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center mr-2">
                            <i class="fa fa-user text-primary"></i>
                        </div>
                        <span class="text-white font-medium">${username}</span>
                        <span class="text-white/50 text-xs ml-auto">${timeString}</span>
                    </div>
                    <p class="text-white/70">${message}</p>
                `;
                
                messagesContainer.appendChild(messageElement);
                messageInput.value = '';
                messagesContainer.scrollTop = messagesContainer.scrollHeight;
            }
        }

        // 上传文件功能
        document.getElementById('submit-upload').addEventListener('click', () => {
            const username = document.getElementById('username').value;
            const message = document.getElementById('upload-message').value;
            
            if (!username) {
                alert('请先设置用户名');
                return;
            }
            
            const fileInput = document.getElementById('file-upload');
            if (fileInput.files.length > 0) {
                alert('文件上传成功！');
                document.getElementById('upload-message').value = '';
                fileInput.value = '';
                
                // 模拟发布上传消息
                const messagesContainer = document.getElementById('messages-container');
                const now = new Date();
                const timeString = `${now.getHours()}:${now.getMinutes().toString().padStart(2, '0')}`;
                
                const messageElement = document.createElement('div');
                messageElement.className = 'p-4 bg-dark/70 rounded-lg border border-gray-700';
                messageElement.innerHTML = `
                    <div class="flex items-center mb-2">
                        <div class="w-8 h-8 rounded-full bg-primary/20 flex items-center justify-center mr-2">
                            <i class="fa fa-user text-primary"></i>
                        </div>
                        <span class="text-white font-medium">${username}</span>
                        <span class="text-white/50 text-xs ml-auto">${timeString}</span>
                    </div>
                    <p class="text-white/70 mb-2">${message || '分享了一个文件'}</p>
                    <div class="bg-dark/50 p-2 rounded flex items-center">
                        <i class="fa fa-file text-primary mr-2"></i>
                        <span class="text-white/60 text-sm">${fileInput.files[0].name}</span>
                    </div>
                `;
                
                messagesContainer.appendChild(messageElement);
                messagesContainer.scrollTop = messagesContainer.scrollHeight;
            } else {
                alert('请选择要上传的文件');
            }
        });
    </script>
</body>
</html>

